import http from '../request.js'

// 获取角色信息列表
let roleGetList = (url, params) => {
    return http.req(
        'get',
        url = 'system/role/getList',
        params,
        null
    )
}

// 获取角色信息详情
let roleGetInfo = (url, roleId) => {
    return http.req(
        'get',
        url = 'system/role/getInfo?roleId='+roleId,
        null,
        null
    )
}

// 添加角色信息
let roleAdd = (url, data) => {
    return http.req(
        'post',
        url = 'system/role/add',
        null,
        data
    )
}

// 删除角色信息
let roleRemove = (url, roleId) => {
    return http.req(
        'delete',
        url = 'system/role/remove?roleId=' + roleId,
        null,
        null
    )
}

// 编辑角色信息
let roleEdit = (url, data) => {
    return http.req(
        'put',
        url = 'system/role/edit',
        null,
        data
    )
}

// 获取权限
let roleGetPermissions = (url, roleId) => {
    return http.req(
        'get',
        url = 'system/role/getPermissions?roleId=' + roleId,
        null,
        null
    )
}

// 角色赋予权限
let roleSetPermissions = (url, data) => {
    return http.req(
        'post',
        url = 'system/role/setPermissions',
        null,
        data
    )
}

export default {
    roleGetList,
    roleGetInfo,
    roleAdd,
    roleRemove,
    roleEdit,
    roleGetPermissions,
    roleSetPermissions
}